﻿using System;
using System.Data;
using System.Text;
using MySql.Data.MySqlClient;
using Maticsoft.DBUtility;//Please add references
namespace hcrainMvc.DAL
{
	/// <summary>
	/// 数据访问类:order_sp
	/// </summary>
	public partial class order_sp
	{
		public order_sp()
		{}
		#region  BasicMethod

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(long id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from order_sp");
			strSql.Append(" where id=@id");
			MySqlParameter[] parameters = {
					new MySqlParameter("@id", MySqlDbType.Int64)
			};
			parameters[0].Value = id;

			return DbHelperMySQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(hcrainMvc.Model.order_sp model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into order_sp(");
			strSql.Append("type,typename,mainname,maintype,fv1,fv2,fv3,fv4,fv5,fv6,fv7,fv8,fv9,fv10,nv1,nv2,nv3,nv4,nv5,nv6,nv7,nv8,nv9,nv10,dt1,dt2,dt3,dt4,addtime,bj,adduser,wfSetupName,wfHistoryRole,wfid,isComplete,isStop,fatherid,modelid,addorgthis,addorgmain,state,wfHistoryUser,fhcrwfadduser,fhcrwdeywstates,orderUserId,orderUserName,orderUserCTel,orderUserCName,orderUserAddress,orderMNo,orderMName,orderMCount,orderMHtNo,orderMType,orderTime,orderMColor,orderSendTime,orderSendAddress)");
			strSql.Append(" values (");
			strSql.Append("@type,@typename,@mainname,@maintype,@fv1,@fv2,@fv3,@fv4,@fv5,@fv6,@fv7,@fv8,@fv9,@fv10,@nv1,@nv2,@nv3,@nv4,@nv5,@nv6,@nv7,@nv8,@nv9,@nv10,@dt1,@dt2,@dt3,@dt4,@addtime,@bj,@adduser,@wfSetupName,@wfHistoryRole,@wfid,@isComplete,@isStop,@fatherid,@modelid,@addorgthis,@addorgmain,@state,@wfHistoryUser,@fhcrwfadduser,@fhcrwdeywstates,@orderUserId,@orderUserName,@orderUserCTel,@orderUserCName,@orderUserAddress,@orderMNo,@orderMName,@orderMCount,@orderMHtNo,@orderMType,@orderTime,@orderMColor,@orderSendTime,@orderSendAddress)");
			MySqlParameter[] parameters = {
					new MySqlParameter("@type", MySqlDbType.Int32,11),
					new MySqlParameter("@typename", MySqlDbType.VarChar,50),
					new MySqlParameter("@mainname", MySqlDbType.VarChar,200),
					new MySqlParameter("@maintype", MySqlDbType.Int32,11),
					new MySqlParameter("@fv1", MySqlDbType.Text),
					new MySqlParameter("@fv2", MySqlDbType.Text),
					new MySqlParameter("@fv3", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv4", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv5", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv6", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv7", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv8", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv9", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv10", MySqlDbType.VarChar,200),
					new MySqlParameter("@nv1", MySqlDbType.Double),
					new MySqlParameter("@nv2", MySqlDbType.Double),
					new MySqlParameter("@nv3", MySqlDbType.Double),
					new MySqlParameter("@nv4", MySqlDbType.Double),
					new MySqlParameter("@nv5", MySqlDbType.Double),
					new MySqlParameter("@nv6", MySqlDbType.Double),
					new MySqlParameter("@nv7", MySqlDbType.Double),
					new MySqlParameter("@nv8", MySqlDbType.Double),
					new MySqlParameter("@nv9", MySqlDbType.Double),
					new MySqlParameter("@nv10", MySqlDbType.Double),
					new MySqlParameter("@dt1", MySqlDbType.DateTime),
					new MySqlParameter("@dt2", MySqlDbType.DateTime),
					new MySqlParameter("@dt3", MySqlDbType.DateTime),
					new MySqlParameter("@dt4", MySqlDbType.DateTime),
					new MySqlParameter("@addtime", MySqlDbType.Timestamp),
					new MySqlParameter("@bj", MySqlDbType.Text),
					new MySqlParameter("@adduser", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfSetupName", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfHistoryRole", MySqlDbType.VarChar,255),
					new MySqlParameter("@wfid", MySqlDbType.VarChar,50),
					new MySqlParameter("@isComplete", MySqlDbType.VarChar,50),
					new MySqlParameter("@isStop", MySqlDbType.VarChar,50),
					new MySqlParameter("@fatherid", MySqlDbType.Double),
					new MySqlParameter("@modelid", MySqlDbType.Double),
					new MySqlParameter("@addorgthis", MySqlDbType.VarChar,50),
					new MySqlParameter("@addorgmain", MySqlDbType.VarChar,50),
					new MySqlParameter("@state", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfHistoryUser", MySqlDbType.VarChar,255),
					new MySqlParameter("@fhcrwfadduser", MySqlDbType.VarChar,100),
					new MySqlParameter("@fhcrwdeywstates", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserId", MySqlDbType.Int32,11),
					new MySqlParameter("@orderUserName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserCTel", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserCName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserAddress", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMNo", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMCount", MySqlDbType.Int32,10),
					new MySqlParameter("@orderMHtNo", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMType", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderTime", MySqlDbType.DateTime),
					new MySqlParameter("@orderMColor", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderSendTime", MySqlDbType.DateTime),
					new MySqlParameter("@orderSendAddress", MySqlDbType.VarChar,200)};
			parameters[0].Value = model.type;
			parameters[1].Value = model.typename;
			parameters[2].Value = model.mainname;
			parameters[3].Value = model.maintype;
			parameters[4].Value = model.fv1;
			parameters[5].Value = model.fv2;
			parameters[6].Value = model.fv3;
			parameters[7].Value = model.fv4;
			parameters[8].Value = model.fv5;
			parameters[9].Value = model.fv6;
			parameters[10].Value = model.fv7;
			parameters[11].Value = model.fv8;
			parameters[12].Value = model.fv9;
			parameters[13].Value = model.fv10;
			parameters[14].Value = model.nv1;
			parameters[15].Value = model.nv2;
			parameters[16].Value = model.nv3;
			parameters[17].Value = model.nv4;
			parameters[18].Value = model.nv5;
			parameters[19].Value = model.nv6;
			parameters[20].Value = model.nv7;
			parameters[21].Value = model.nv8;
			parameters[22].Value = model.nv9;
			parameters[23].Value = model.nv10;
			parameters[24].Value = model.dt1;
			parameters[25].Value = model.dt2;
			parameters[26].Value = model.dt3;
			parameters[27].Value = model.dt4;
			parameters[28].Value = model.addtime;
			parameters[29].Value = model.bj;
			parameters[30].Value = model.adduser;
			parameters[31].Value = model.wfSetupName;
			parameters[32].Value = model.wfHistoryRole;
			parameters[33].Value = model.wfid;
			parameters[34].Value = model.isComplete;
			parameters[35].Value = model.isStop;
			parameters[36].Value = model.fatherid;
			parameters[37].Value = model.modelid;
			parameters[38].Value = model.addorgthis;
			parameters[39].Value = model.addorgmain;
			parameters[40].Value = model.state;
			parameters[41].Value = model.wfHistoryUser;
			parameters[42].Value = model.fhcrwfadduser;
			parameters[43].Value = model.fhcrwdeywstates;
			parameters[44].Value = model.orderUserId;
			parameters[45].Value = model.orderUserName;
			parameters[46].Value = model.orderUserCTel;
			parameters[47].Value = model.orderUserCName;
			parameters[48].Value = model.orderUserAddress;
			parameters[49].Value = model.orderMNo;
			parameters[50].Value = model.orderMName;
			parameters[51].Value = model.orderMCount;
			parameters[52].Value = model.orderMHtNo;
			parameters[53].Value = model.orderMType;
			parameters[54].Value = model.orderTime;
			parameters[55].Value = model.orderMColor;
			parameters[56].Value = model.orderSendTime;
			parameters[57].Value = model.orderSendAddress;

			int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(hcrainMvc.Model.order_sp model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update order_sp set ");
			strSql.Append("type=@type,");
			strSql.Append("typename=@typename,");
			strSql.Append("mainname=@mainname,");
			strSql.Append("maintype=@maintype,");
			strSql.Append("fv1=@fv1,");
			strSql.Append("fv2=@fv2,");
			strSql.Append("fv3=@fv3,");
			strSql.Append("fv4=@fv4,");
			strSql.Append("fv5=@fv5,");
			strSql.Append("fv6=@fv6,");
			strSql.Append("fv7=@fv7,");
			strSql.Append("fv8=@fv8,");
			strSql.Append("fv9=@fv9,");
			strSql.Append("fv10=@fv10,");
			strSql.Append("nv1=@nv1,");
			strSql.Append("nv2=@nv2,");
			strSql.Append("nv3=@nv3,");
			strSql.Append("nv4=@nv4,");
			strSql.Append("nv5=@nv5,");
			strSql.Append("nv6=@nv6,");
			strSql.Append("nv7=@nv7,");
			strSql.Append("nv8=@nv8,");
			strSql.Append("nv9=@nv9,");
			strSql.Append("nv10=@nv10,");
			strSql.Append("dt1=@dt1,");
			strSql.Append("dt2=@dt2,");
			strSql.Append("dt3=@dt3,");
			strSql.Append("dt4=@dt4,");
			strSql.Append("bj=@bj,");
			strSql.Append("adduser=@adduser,");
			strSql.Append("wfSetupName=@wfSetupName,");
			strSql.Append("wfHistoryRole=@wfHistoryRole,");
			strSql.Append("wfid=@wfid,");
			strSql.Append("isComplete=@isComplete,");
			strSql.Append("isStop=@isStop,");
			strSql.Append("fatherid=@fatherid,");
			strSql.Append("modelid=@modelid,");
			strSql.Append("addorgthis=@addorgthis,");
			strSql.Append("addorgmain=@addorgmain,");
			strSql.Append("state=@state,");
			strSql.Append("wfHistoryUser=@wfHistoryUser,");
			strSql.Append("fhcrwfadduser=@fhcrwfadduser,");
			strSql.Append("fhcrwdeywstates=@fhcrwdeywstates,");
			strSql.Append("orderUserId=@orderUserId,");
			strSql.Append("orderUserName=@orderUserName,");
			strSql.Append("orderUserCTel=@orderUserCTel,");
			strSql.Append("orderUserCName=@orderUserCName,");
			strSql.Append("orderUserAddress=@orderUserAddress,");
			strSql.Append("orderMNo=@orderMNo,");
			strSql.Append("orderMName=@orderMName,");
			strSql.Append("orderMCount=@orderMCount,");
			strSql.Append("orderMHtNo=@orderMHtNo,");
			strSql.Append("orderMType=@orderMType,");
			strSql.Append("orderTime=@orderTime,");
			strSql.Append("orderMColor=@orderMColor,");
			strSql.Append("orderSendTime=@orderSendTime,");
			strSql.Append("orderSendAddress=@orderSendAddress");
			strSql.Append(" where id=@id");
			MySqlParameter[] parameters = {
					new MySqlParameter("@type", MySqlDbType.Int32,11),
					new MySqlParameter("@typename", MySqlDbType.VarChar,50),
					new MySqlParameter("@mainname", MySqlDbType.VarChar,200),
					new MySqlParameter("@maintype", MySqlDbType.Int32,11),
					new MySqlParameter("@fv1", MySqlDbType.Text),
					new MySqlParameter("@fv2", MySqlDbType.Text),
					new MySqlParameter("@fv3", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv4", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv5", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv6", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv7", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv8", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv9", MySqlDbType.VarChar,200),
					new MySqlParameter("@fv10", MySqlDbType.VarChar,200),
					new MySqlParameter("@nv1", MySqlDbType.Double),
					new MySqlParameter("@nv2", MySqlDbType.Double),
					new MySqlParameter("@nv3", MySqlDbType.Double),
					new MySqlParameter("@nv4", MySqlDbType.Double),
					new MySqlParameter("@nv5", MySqlDbType.Double),
					new MySqlParameter("@nv6", MySqlDbType.Double),
					new MySqlParameter("@nv7", MySqlDbType.Double),
					new MySqlParameter("@nv8", MySqlDbType.Double),
					new MySqlParameter("@nv9", MySqlDbType.Double),
					new MySqlParameter("@nv10", MySqlDbType.Double),
					new MySqlParameter("@dt1", MySqlDbType.DateTime),
					new MySqlParameter("@dt2", MySqlDbType.DateTime),
					new MySqlParameter("@dt3", MySqlDbType.DateTime),
					new MySqlParameter("@dt4", MySqlDbType.DateTime),
					new MySqlParameter("@bj", MySqlDbType.Text),
					new MySqlParameter("@adduser", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfSetupName", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfHistoryRole", MySqlDbType.VarChar,255),
					new MySqlParameter("@wfid", MySqlDbType.VarChar,50),
					new MySqlParameter("@isComplete", MySqlDbType.VarChar,50),
					new MySqlParameter("@isStop", MySqlDbType.VarChar,50),
					new MySqlParameter("@fatherid", MySqlDbType.Double),
					new MySqlParameter("@modelid", MySqlDbType.Double),
					new MySqlParameter("@addorgthis", MySqlDbType.VarChar,50),
					new MySqlParameter("@addorgmain", MySqlDbType.VarChar,50),
					new MySqlParameter("@state", MySqlDbType.VarChar,50),
					new MySqlParameter("@wfHistoryUser", MySqlDbType.VarChar,255),
					new MySqlParameter("@fhcrwfadduser", MySqlDbType.VarChar,100),
					new MySqlParameter("@fhcrwdeywstates", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserId", MySqlDbType.Int32,11),
					new MySqlParameter("@orderUserName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserCTel", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserCName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderUserAddress", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMNo", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMName", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMCount", MySqlDbType.Int32,10),
					new MySqlParameter("@orderMHtNo", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderMType", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderTime", MySqlDbType.DateTime),
					new MySqlParameter("@orderMColor", MySqlDbType.VarChar,100),
					new MySqlParameter("@orderSendTime", MySqlDbType.DateTime),
					new MySqlParameter("@orderSendAddress", MySqlDbType.VarChar,200),
					new MySqlParameter("@id", MySqlDbType.Int64,20)};
			parameters[0].Value = model.type;
			parameters[1].Value = model.typename;
			parameters[2].Value = model.mainname;
			parameters[3].Value = model.maintype;
			parameters[4].Value = model.fv1;
			parameters[5].Value = model.fv2;
			parameters[6].Value = model.fv3;
			parameters[7].Value = model.fv4;
			parameters[8].Value = model.fv5;
			parameters[9].Value = model.fv6;
			parameters[10].Value = model.fv7;
			parameters[11].Value = model.fv8;
			parameters[12].Value = model.fv9;
			parameters[13].Value = model.fv10;
			parameters[14].Value = model.nv1;
			parameters[15].Value = model.nv2;
			parameters[16].Value = model.nv3;
			parameters[17].Value = model.nv4;
			parameters[18].Value = model.nv5;
			parameters[19].Value = model.nv6;
			parameters[20].Value = model.nv7;
			parameters[21].Value = model.nv8;
			parameters[22].Value = model.nv9;
			parameters[23].Value = model.nv10;
			parameters[24].Value = model.dt1;
			parameters[25].Value = model.dt2;
			parameters[26].Value = model.dt3;
			parameters[27].Value = model.dt4;
			parameters[28].Value = model.bj;
			parameters[29].Value = model.adduser;
			parameters[30].Value = model.wfSetupName;
			parameters[31].Value = model.wfHistoryRole;
			parameters[32].Value = model.wfid;
			parameters[33].Value = model.isComplete;
			parameters[34].Value = model.isStop;
			parameters[35].Value = model.fatherid;
			parameters[36].Value = model.modelid;
			parameters[37].Value = model.addorgthis;
			parameters[38].Value = model.addorgmain;
			parameters[39].Value = model.state;
			parameters[40].Value = model.wfHistoryUser;
			parameters[41].Value = model.fhcrwfadduser;
			parameters[42].Value = model.fhcrwdeywstates;
			parameters[43].Value = model.orderUserId;
			parameters[44].Value = model.orderUserName;
			parameters[45].Value = model.orderUserCTel;
			parameters[46].Value = model.orderUserCName;
			parameters[47].Value = model.orderUserAddress;
			parameters[48].Value = model.orderMNo;
			parameters[49].Value = model.orderMName;
			parameters[50].Value = model.orderMCount;
			parameters[51].Value = model.orderMHtNo;
			parameters[52].Value = model.orderMType;
			parameters[53].Value = model.orderTime;
			parameters[54].Value = model.orderMColor;
			parameters[55].Value = model.orderSendTime;
			parameters[56].Value = model.orderSendAddress;
			parameters[57].Value = model.id;

			int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from order_sp ");
			strSql.Append(" where id=@id");
			MySqlParameter[] parameters = {
					new MySqlParameter("@id", MySqlDbType.Int64)
			};
			parameters[0].Value = id;

			int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from order_sp ");
			strSql.Append(" where id in ("+idlist + ")  ");
			int rows=DbHelperMySQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public hcrainMvc.Model.order_sp GetModel(long id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select id,type,typename,mainname,maintype,fv1,fv2,fv3,fv4,fv5,fv6,fv7,fv8,fv9,fv10,nv1,nv2,nv3,nv4,nv5,nv6,nv7,nv8,nv9,nv10,dt1,dt2,dt3,dt4,addtime,bj,adduser,wfSetupName,wfHistoryRole,wfid,isComplete,isStop,fatherid,modelid,addorgthis,addorgmain,state,wfHistoryUser,fhcrwfadduser,fhcrwdeywstates,orderUserId,orderUserName,orderUserCTel,orderUserCName,orderUserAddress,orderMNo,orderMName,orderMCount,orderMHtNo,orderMType,orderTime,orderMColor,orderSendTime,orderSendAddress from order_sp ");
			strSql.Append(" where id=@id");
			MySqlParameter[] parameters = {
					new MySqlParameter("@id", MySqlDbType.Int64)
			};
			parameters[0].Value = id;

			hcrainMvc.Model.order_sp model=new hcrainMvc.Model.order_sp();
			DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public hcrainMvc.Model.order_sp DataRowToModel(DataRow row)
		{
			hcrainMvc.Model.order_sp model=new hcrainMvc.Model.order_sp();
			if (row != null)
			{
				if(row["id"]!=null && row["id"].ToString()!="")
				{
					model.id=long.Parse(row["id"].ToString());
				}
				if(row["type"]!=null && row["type"].ToString()!="")
				{
					model.type=int.Parse(row["type"].ToString());
				}
				if(row["typename"]!=null)
				{
					model.typename=row["typename"].ToString();
				}
				if(row["mainname"]!=null)
				{
					model.mainname=row["mainname"].ToString();
				}
				if(row["maintype"]!=null && row["maintype"].ToString()!="")
				{
					model.maintype=int.Parse(row["maintype"].ToString());
				}
				if(row["fv1"]!=null)
				{
					model.fv1=row["fv1"].ToString();
				}
				if(row["fv2"]!=null)
				{
					model.fv2=row["fv2"].ToString();
				}
				if(row["fv3"]!=null)
				{
					model.fv3=row["fv3"].ToString();
				}
				if(row["fv4"]!=null)
				{
					model.fv4=row["fv4"].ToString();
				}
				if(row["fv5"]!=null)
				{
					model.fv5=row["fv5"].ToString();
				}
				if(row["fv6"]!=null)
				{
					model.fv6=row["fv6"].ToString();
				}
				if(row["fv7"]!=null)
				{
					model.fv7=row["fv7"].ToString();
				}
				if(row["fv8"]!=null)
				{
					model.fv8=row["fv8"].ToString();
				}
				if(row["fv9"]!=null)
				{
					model.fv9=row["fv9"].ToString();
				}
				if(row["fv10"]!=null)
				{
					model.fv10=row["fv10"].ToString();
				}
					//model.nv1=row["nv1"].ToString();
					//model.nv2=row["nv2"].ToString();
					//model.nv3=row["nv3"].ToString();
					//model.nv4=row["nv4"].ToString();
					//model.nv5=row["nv5"].ToString();
					//model.nv6=row["nv6"].ToString();
					//model.nv7=row["nv7"].ToString();
					//model.nv8=row["nv8"].ToString();
					//model.nv9=row["nv9"].ToString();
					//model.nv10=row["nv10"].ToString();
				if(row["dt1"]!=null && row["dt1"].ToString()!="")
				{
					model.dt1=DateTime.Parse(row["dt1"].ToString());
				}
				if(row["dt2"]!=null && row["dt2"].ToString()!="")
				{
					model.dt2=DateTime.Parse(row["dt2"].ToString());
				}
				if(row["dt3"]!=null && row["dt3"].ToString()!="")
				{
					model.dt3=DateTime.Parse(row["dt3"].ToString());
				}
				if(row["dt4"]!=null && row["dt4"].ToString()!="")
				{
					model.dt4=DateTime.Parse(row["dt4"].ToString());
				}
				if(row["addtime"]!=null && row["addtime"].ToString()!="")
				{
					model.addtime=DateTime.Parse(row["addtime"].ToString());
				}
				if(row["bj"]!=null)
				{
					model.bj=row["bj"].ToString();
				}
				if(row["adduser"]!=null)
				{
					model.adduser=row["adduser"].ToString();
				}
				if(row["wfSetupName"]!=null)
				{
					model.wfSetupName=row["wfSetupName"].ToString();
				}
				if(row["wfHistoryRole"]!=null)
				{
					model.wfHistoryRole=row["wfHistoryRole"].ToString();
				}
				if(row["wfid"]!=null)
				{
					model.wfid=row["wfid"].ToString();
				}
				if(row["isComplete"]!=null)
				{
					model.isComplete=row["isComplete"].ToString();
				}
				if(row["isStop"]!=null)
				{
					model.isStop=row["isStop"].ToString();
				}
					//model.fatherid=row["fatherid"].ToString();
					//model.modelid=row["modelid"].ToString();
				if(row["addorgthis"]!=null)
				{
					model.addorgthis=row["addorgthis"].ToString();
				}
				if(row["addorgmain"]!=null)
				{
					model.addorgmain=row["addorgmain"].ToString();
				}
				if(row["state"]!=null)
				{
					model.state=row["state"].ToString();
				}
				if(row["wfHistoryUser"]!=null)
				{
					model.wfHistoryUser=row["wfHistoryUser"].ToString();
				}
				if(row["fhcrwfadduser"]!=null)
				{
					model.fhcrwfadduser=row["fhcrwfadduser"].ToString();
				}
				if(row["fhcrwdeywstates"]!=null)
				{
					model.fhcrwdeywstates=row["fhcrwdeywstates"].ToString();
				}
				if(row["orderUserId"]!=null && row["orderUserId"].ToString()!="")
				{
					model.orderUserId=int.Parse(row["orderUserId"].ToString());
				}
				if(row["orderUserName"]!=null)
				{
					model.orderUserName=row["orderUserName"].ToString();
				}
				if(row["orderUserCTel"]!=null)
				{
					model.orderUserCTel=row["orderUserCTel"].ToString();
				}
				if(row["orderUserCName"]!=null)
				{
					model.orderUserCName=row["orderUserCName"].ToString();
				}
				if(row["orderUserAddress"]!=null)
				{
					model.orderUserAddress=row["orderUserAddress"].ToString();
				}
				if(row["orderMNo"]!=null)
				{
					model.orderMNo=row["orderMNo"].ToString();
				}
				if(row["orderMName"]!=null)
				{
					model.orderMName=row["orderMName"].ToString();
				}
				if(row["orderMCount"]!=null && row["orderMCount"].ToString()!="")
				{
					model.orderMCount=int.Parse(row["orderMCount"].ToString());
				}
				if(row["orderMHtNo"]!=null)
				{
					model.orderMHtNo=row["orderMHtNo"].ToString();
				}
				if(row["orderMType"]!=null)
				{
					model.orderMType=row["orderMType"].ToString();
				}
				if(row["orderTime"]!=null && row["orderTime"].ToString()!="")
				{
					model.orderTime=DateTime.Parse(row["orderTime"].ToString());
				}
				if(row["orderMColor"]!=null)
				{
					model.orderMColor=row["orderMColor"].ToString();
				}
				if(row["orderSendTime"]!=null && row["orderSendTime"].ToString()!="")
				{
					model.orderSendTime=DateTime.Parse(row["orderSendTime"].ToString());
				}
				if(row["orderSendAddress"]!=null)
				{
					model.orderSendAddress=row["orderSendAddress"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select id,type,typename,mainname,maintype,fv1,fv2,fv3,fv4,fv5,fv6,fv7,fv8,fv9,fv10,nv1,nv2,nv3,nv4,nv5,nv6,nv7,nv8,nv9,nv10,dt1,dt2,dt3,dt4,addtime,bj,adduser,wfSetupName,wfHistoryRole,wfid,isComplete,isStop,fatherid,modelid,addorgthis,addorgmain,state,wfHistoryUser,fhcrwfadduser,fhcrwdeywstates,orderUserId,orderUserName,orderUserCTel,orderUserCName,orderUserAddress,orderMNo,orderMName,orderMCount,orderMHtNo,orderMType,orderTime,orderMColor,orderSendTime,orderSendAddress ");
			strSql.Append(" FROM order_sp ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperMySQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM order_sp ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.id desc");
			}
			strSql.Append(")AS Row, T.*  from order_sp T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperMySQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			MySqlParameter[] parameters = {
					new MySqlParameter("@tblName", MySqlDbType.VarChar, 255),
					new MySqlParameter("@fldName", MySqlDbType.VarChar, 255),
					new MySqlParameter("@PageSize", MySqlDbType.Int32),
					new MySqlParameter("@PageIndex", MySqlDbType.Int32),
					new MySqlParameter("@IsReCount", MySqlDbType.Bit),
					new MySqlParameter("@OrderType", MySqlDbType.Bit),
					new MySqlParameter("@strWhere", MySqlDbType.VarChar,1000),
					};
			parameters[0].Value = "order_sp";
			parameters[1].Value = "id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperMySQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod

		#endregion  ExtensionMethod
	}
}

